package cn.dakaqi.entities;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;

import javax.persistence.*;
import java.util.Date;

/**
 * Created by chunyang on 2016/5/4.
 */
@Entity
@Cacheable
@Table(name = "U_VOLUNTEER_MONEY")
public class VolunteerMoney extends IdEntity
{
    private Volunteer volunteer;
    private int eventCode;
    private Date createTime;
    private int money;

    public VolunteerMoney()
    {
    }

    public VolunteerMoney(Long id)
    {
        this.id = id;
    }
    // JPA 基于USER_ID列的多对一关系定义
    @JsonIgnore
    @ManyToOne
    @JoinColumn(name = "VOLUNTEER_ID")
    public Volunteer getVolunteer()
    {
        return volunteer;
    }

    public void setVolunteer(Volunteer volunteer)
    {
        this.volunteer = volunteer;
    }

    public int getEventCode()
    {
        return eventCode;
    }

    public void setEventCode(int eventCode)
    {
        this.eventCode = eventCode;
    }
    // 设定JSON序列化时的日期格式
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime()
    {
        return createTime;
    }

    public void setCreateTime(Date createTime)
    {
        this.createTime = createTime;
    }

    public int getMoney()
    {
        return money;
    }

    public void setMoney(int money)
    {
        this.money = money;
    }
}
